package com.itheima.a01;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;

import java.util.logging.Logger;

/**
 * @author: AirMan
 * @date: 2025/4/8 15:41
 * @description:
 */

@Component
public class ComponentTest01 {

    private static final Logger log = Logger.getLogger(String.valueOf(ComponentTest01.class));
    @Autowired
    private ApplicationEventPublisher context;

    // 发布时间
    public void sendEvent() {
        log.info("send event...");
        context.publishEvent(new UserRegisterEvent(this));
    }
}
